package logic

import (
	"context"
	"order_srv/internal/dao"
	"order_srv/internal/svc"
	"smart-health-platforms/pkg"

	"order_srv/order"

	"github.com/zeromicro/go-zero/core/logx"
)

type OrderUpdatePayStatusLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewOrderUpdatePayStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OrderUpdatePayStatusLogic {
	return &OrderUpdatePayStatusLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *OrderUpdatePayStatusLogic) OrderUpdatePayStatus(in *order.OrderUpdatePayStatusRequest) (*order.OrderUpdatePayStatusResponse, error) {
	_, err := dao.UpdateOrderPay(in)
	if err != nil {
		pkg.Warn("更新订单支付状态失败")
		return nil, err
	}

	return &order.OrderUpdatePayStatusResponse{}, nil
}
